<?
echo "+";
$sources = file('./wgets/sourcesB.txt');
echo count($sources)."+<br>";

while(list($skey,$sval)=each($sources)){
	if($sval!='\n'){
		$fval = './wgets/'.trim(str_replace('http://','',$sval)).'index.html';
		//echo " ::".$MYud."<br><a href=\"".$fval."\" target=\"_new\">".$fval."</a>";
		$MYud = '';
			$dataf = file($fval);
			$val = join ('',$dataf);

		//echo substr_count($val,"'/s/")."<br>";
		if(stristr($val,"'/s/")){
			$valA = explode("'/s/",$val);
			//echo count($valA)."<br>";
			//echo htmlspecialchars($valA[0]);
			
			for($i = 1; $i <count($valA); $i++){
					$val2 = $valA[$i];
					if(stristr($val2,"/1/'>")){
						$collection = $collection +1;
						$v2A = explode("/1/'>",$val2);
								$dataA[$collection]['id'] = $v2A[0];
						$t = explode('</a>',$v2A[1]);
							$dataA[$collection]['title'] = $t[0];
							//echo $t[0];
							$t2 =explode('/u/',$t[1]);
							$t3 =explode("/'>",$t2[1]);
								$dataA[$collection]['author_id'] = $t3[0];
								$dataA[$collection]['author'] = $t3[1];
						$v3A = explode("<blockquote>",$val2);		
						$t2 = explode('</blockquote',$v3A[1]);
						//echo htmlspecialchars($t2[0])."<hr>";
						
						
						
						$t3 = explode("<br><span class='gray' style='font-size=11px'>", $t2[0]);
							$dataA[$collection]['summary'] = trim($t3[0]);
							//echo htmlspecialchars(trim($t3[0]));
						$t4 = explode(" - ", $t3[1]);
						$dataA[$collection]['chapters'] = str_replace('Chapters: ','',$t4[3]);
						$ud1 = str_replace('Updated: ','',$t4[6]);
						$pd1 = strip_tags(str_replace('Published: ','',$t4[7]));
						$ud2 = explode('-',$ud1);
						if(strlen($ud2[0])==1){ $ud2a='0'; }else{ $ud2a='';}
						if(strlen($ud2[1])==1){ $ud2b='0'; }else{ $ud2b='';}
						
						$ud3 = '20'.$ud2[2].'-'.$ud2a.$ud2[0].'-'.$ud2b.$ud2[1];
						$pd2 = explode('-',$pd1);
						if(strlen($pd2[0])==1){ $pd2a='0'; }else{ $pd2a='';}
						if(strlen($pd2[1])==1){ $pd2b='0'; }else{ $pd2b='';}
						$pd3 = '20'.$pd2[2].'-'.$pd2a.$pd2[0].'-'.$pd2b.$pd2[1];
						$dataA[$collection]['updated'] = $ud3;
						$MYud = $ud3;
						if($ud3<$aDT[$cat] && $ud3!='20--'){
							$pageL=false;
						}
						$dataA[$collection]['published'] = $pd3;
						/*
						*/
					
					}			
			}
		}

	}
}



echo "<hr>";
echo "Fics Found: ".count($dataA);

require('/home/httpd/html/adodb/adodb.inc.php');

$db = &ADONewConnection('mysql');
$db->PConnect('localhost','root','ttshb**','lpreston');

var_dump($dataA);

echo "<br>Known Fics: ".$cnta."<br>&nbsp;&nbsp;Updated Choice: ".$cnt."<br>&nbsp;&nbsp;Updated Other: ".$cnt1."<br>New Fics: ".$cnt2;
?>